"""
persistence.py
Split from thomas.py by Gleicon Moraes on 2009-03-02.

Datatype support for thomas.py and persistence.py

"""
from google.appengine.ext import db

class BayesData(dict):

    def __init__(self, name='', pool=None):
        self.name = name
        self.training = []
        self.pool = pool
        self.tokenCount = 0
        self.trainCount = 0
        
    def trainedOn(self, item):
        return item in self.training

    def __repr__(self):
        return '<BayesDict: %s, %s tokens>' % (self.name, self.tokenCount)

class PoolStorage(db.Model):
    pool = db.StringProperty()
    token = db.StringProperty()
    ct = db.IntegerProperty()

